package com.example.bookmanagementsystem.enums;

import lombok.Data;

public enum BookStatusEnum {
    DELETE(0, "删除"),
    NORMAL(1, "可借阅"),
    FORBIDDEN(2, "不可借阅");

    private Integer statusCode;
    private String statusName;

    public static BookStatusEnum getNameByCode(Integer code) {
        switch (code) {
            case 0: {
                return BookStatusEnum.DELETE;
            }
            case 1: {
                return BookStatusEnum.NORMAL;
            }
            default: {
                return BookStatusEnum.FORBIDDEN;
            }
        }
    }

    private BookStatusEnum(Integer statusCode, String statusName) {
        this.statusCode = statusCode;
        this.statusName = statusName;
    }

    public Integer getStatusCode() {
        return statusCode;
    }

    public void setStatusCode(Integer statusCode) {
        this.statusCode = statusCode;
    }

    public String getStatusName() {
        return statusName;
    }

    public void setStatusName(String statusName) {
        this.statusName = statusName;
    }
}
